version: "3"
###################################################################################
services:
  iqc1:
    image: "docker.iqstore.ru/iqchannels:4.1.0-dev2"
    container_name: iqc1
    ports:
      - "3011:3001"
      - "3012:3002"
    volumes:
      - /opt/config.yaml:/iqchannels/config/config.yaml
      - /opt:/iqchannels/var/log/
#    restart: unless-stopped
    healthcheck:
      test: curl --fail http://localhost:3002/api/status || exit 1
      interval: 5s
      retries: 5
      timeout: 10s
    #depends_on:
      #- redis-sentinel1
      #- redis-sentinel2
      #- redis-sentinel3
    command:
      - run
###################################################################################
  iqc2:
    image: "docker.iqstore.ru/iqchannels:4.1.0-dev2"
    container_name: iqc2
    ports:
      - "4011:3001"
      - "4012:3002"
    volumes:
      - /opt/config.yaml:/iqchannels/config/config.yaml
      - /opt:/iqchannels/var/log/
#    restart: unless-stopped
    healthcheck:
      test: curl --fail http://localhost:3002/api/status || exit 1
      interval: 5s
      retries: 5
      timeout: 10s
    #depends_on:
      #- iqc1
      #- redis-sentinel1
      #- redis-sentinel2
      #- redis-sentinel3
    command:
      - run
###################################################################################
  iqc3:
    image: "docker.iqstore.ru/iqchannels:4.1.0-dev2"
    container_name: iqc3
    ports:
      - "5011:3001"
      - "5012:3002"
    volumes:
      - /opt/config.yaml:/iqchannels/config/config.yaml
      - /opt:/iqchannels/var/log/
#    restart: unless-stopped
    healthcheck:
      test: curl --fail http://localhost:3002/api/status || exit 1
      interval: 5s
      retries: 5
      timeout: 10s
    #depends_on:
      #- iqc1
      #- iqc2
      #- redis-sentinel1
      #- redis-sentinel2
      #- redis-sentinel3
    command:
      - run
###################################################################################
  redis:
    image: docker.io/bitnami/redis:7.2
    container_name: rm
    ports:
      - '6379:6379'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_REPLICATION_MODE=master
    volumes:
      - redis_data:/bitnami
###################################################################################
  redis-slave1:
    image: docker.io/bitnami/redis:7.2
    container_name: rrpl1
    ports:
      - '6380:6379'
    depends_on:
      - redis
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_REPLICATION_MODE=slave
      - REDIS_MASTER_HOST=redis
      - REDIS_MASTER_PORT_NUMBER=6379
    volumes:
      - redis_data:/bitnami
####################################################################################
  #redis-slave2:
    #image: docker.io/bitnami/redis:7.2
    #container_name: rrpl2
    #depends_on:
      #- redis
      #- redis-slave1
    #ports:
      #- '6381:6379'
    #environment:
      #- ALLOW_EMPTY_PASSWORD=yes
      #- REDIS_REPLICATION_MODE=slave
      #- REDIS_MASTER_HOST=redis
      #- REDIS_MASTER_PORT_NUMBER=6379
    #volumes:
      #- redis_data:/bitnami
####################################################################################
  #redis-sentinel1:
    #image: docker.io/bitnami/redis-sentinel:7.2
    #container_name: rstl1
    #depends_on:
      #- redis
      #- redis-slave1
      #- redis-slave2
    #ports:
      #- '26379:26379'
    #environment:
      #- ALLOW_EMPTY_PASSWORD=yes
      #- REDIS_MASTER_HOST=redis 
      #- REDIS_MASTER_PORT_NUMBER=6379
      #- REDIS_MASTER_SET=mymaster
      #- REDIS_SENTINEL_RESOLVE_HOSTNAMES=yes
      #- REDIS_SENTINEL_QUORUM=2
      #- REDIS_SENTINEL_DOWN_AFTER_MILLISECONDS=5000
      #- REDIS_SENTINEL_FAILOVER_TIMEOUT=5000
    #volumes:
      #- redis-sentinel_data:/bitnami
####################################################################################
  redis-sentinel2:
    image: docker.io/bitnami/redis-sentinel:7.2
    container_name: rstl2
    #depends_on:
      #- redis
      #- redis-slave1
      #- redis-slave2
    ports:
      - '26380:26379'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
      - REDIS_MASTER_HOST=redis
      - REDIS_MASTER_PORT_NUMBER=6379
      - REDIS_MASTER_SET=mymaster
      - REDIS_SENTINEL_RESOLVE_HOSTNAMES=yes
      - REDIS_SENTINEL_QUORUM=2
      - REDIS_SENTINEL_DOWN_AFTER_MILLISECONDS=5000
      - REDIS_SENTINEL_FAILOVER_TIMEOUT=5000
    volumes:
      - redis-sentinel_data:/bitnami
####################################################################################
  #redis-sentinel3:
    #image: docker.io/bitnami/redis-sentinel:7.2
    #container_name: rstl3
    #depends_on:
      #- redis
      #- redis-slave1
      #- redis-slave2
    #ports:
      #- '26381:26379'
    #environment:
      #- ALLOW_EMPTY_PASSWORD=yes
      #- REDIS_MASTER_HOST=redis
      #- REDIS_MASTER_PORT_NUMBER=6379
      #- REDIS_MASTER_SET=mymaster
      #- REDIS_SENTINEL_RESOLVE_HOSTNAMES=yes
      #- REDIS_SENTINEL_QUORUM=2
      #- REDIS_SENTINEL_DOWN_AFTER_MILLISECONDS=5000
      #- REDIS_SENTINEL_FAILOVER_TIMEOUT=5000
    #volumes:
      #- redis-sentinel_data:/bitnami
####################################################################################
volumes:
  redis-sentinel_data:
    driver: local
  redis_data:
    driver: local
